export function sector_option (data) {
  return {
    series: [
      {
        name: '电力统计',
        type: 'pie',
        radius: ['60%'],
        label: {
          show: false
        },
        data: [
          {
            value: 0,
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: 'rgba(71,210,130,0.8)'
                  },
                  {
                    offset: 0,
                    color: 'rgba(73,160,214,0.8)'
                  }
                ]
              },
              borderWidth: 1,
              borderColor: 'rgba(51,246,176,0.76)'
            }
          },
        ]
      },
      {
        type: 'pie',
        radius: '70%',
        // padAngle: 80,
        name: '电力统计',
        data: [
          {
            name: '可用电力',
            value: data[0],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: 'rgba(0,25,255,0.4)'
                  },
                  {
                    offset: 0,
                    color: 'rgba(0,255,255,0.4)'
                  }
                ]
              },
              borderWidth: 1,
              borderColor: 'rgba(255,255,255,0.33)'
            }
          },
          {
            name: '已用电力',
            value: data[1],
            itemStyle: {
              color: {
                type: 'linear',
                x: 1,
                y: 1,
                x2: 0,
                y2: 0,
                colorStops: [
                  {
                    offset: 1,
                    color: 'rgba(36,254,4,0.8)'
                  },
                  {
                    offset: 0,
                    color: 'rgba(45,255,255,0.8)'
                  }
                ]
              },
              borderWidth: 1,
              borderColor: 'rgba(255,255,255,0.33)'
            }
          },

        ],
        label: {
          show: true,
          position: 'inside',
          formatter: function (params) {
            // 保留两位小数并转换为整数百分比  
            var percent = Math.round((params.percent)) + '%';
            return percent; // 返回数据名和百分比  
          },
          color: '#fff',
          fontSize: 20
        }
      }
    ]
  }
}